#include "NodeList1.h"

NODE *mylist, node[N];

void printlist(NODE *p){
    while(p){
        printf("[%s %d]->",p->name, p->id);
        p = p->next;
    }
    printf("NULL\n");
}

void NodeList1(){
    int i;
    NODE *p;
    for(i = 0; i < N; i++){
        p = &node[i];
        sprintf(p->name, "%s%d", "node", i);
        p->id = i;
        p->next = p + 1;
    }
    node[N-1].next = 0;
    mylist = &node[0];
    printlist(mylist);
}